package cn.controller;

import lombok.extern.apachecommons.CommonsLog;
import lombok.val;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by wushifeng on 2017/4/12.
 * https://github.com/rzwitserloot/lombok/tree/master/usage_examples
 */
@Log
public class LomBokC {
    public void demo() {
        log.info("sss");

        val example = new ArrayList<String>();
        example.add("Hello, World!");
        val foo = example.get(0);

        val map = new HashMap<Integer, String>();
        map.put(0, "zero");
        map.put(5, "five");
        for (val entry : map.entrySet()) {
            System.out.printf("%d: %s\n", entry.getKey(), entry.getValue());
        }
    }

    //我们项目使用这个 https://www.oschina.net/translate/why-use-sl4j-over-log4j-for-logging
    //logger.debug("Processing trade with id: {} and symbol : {} ", id, symbol);
    @Slf4j
    static class LogExampleOther {
        public static void main(String... args) {
            log.error("Something else is wrong here");
        }
    }

    @CommonsLog(topic="CounterLog")
    static class LogExampleCategory {

        public static void main(String... args) {
            log.error("Calling the 'CounterLog' with a message");
        }
    }
}
